Repetier-Firmware  1.0.0
GCodeSource Class Referenceabstract

#include <Communication.h>

Inheritance diagram for GCodeSource:
FlashGCodeSource SerialGCodeSource

Public Member Functions

 GCodeSource ()
 
virtual ~GCodeSource ()
 
virtual bool isOpen ()=0
 
virtual bool supportsWrite ()=0
 true if write is a non dummy function More...
 
virtual bool closeOnError ()=0
 
virtual bool dataAvailable ()=0
 
virtual int readByte ()=0
 
virtual void close ()=0
 
virtual void writeByte (uint8_t byte)=0
 

Static Public Member Functions

static void registerSource (GCodeSource *newSource)
 
static void removeSource (GCodeSource *delSource)
 
static void rotateSource ()
 Move active to next source. More...
 
static void writeToAll (uint8_t byte)
 Write to all listening sources. More...
 
static void printAllFLN (FSTRINGPARAM(text))
 
static void printAllFLN (FSTRINGPARAM(text), int32_t v)
 

Public Attributes

uint32_t lastLineNumber
 
uint8_t wasLastCommandReceivedAsBinary
 Was the last successful command in binary mode? More...
 
millis_t timeOfLastDataPacket
 
int8_t waitingForResend
 Waiting for line to be resend. -1 = no wait. More...
 

Static Public Attributes

static GCodeSource * activeSource = &serial0Source
 

Static Private Attributes

static fast8_t numSources = 2
 Number of data sources available. More...
 
static fast8_t numWriteSources = 2
 
static GCodeSource * sources [MAX_DATA_SOURCES] = {&serial0Source,&serial1Source}
 
static GCodeSource * writeableSources [MAX_DATA_SOURCES] = {&serial0Source,&serial1Source}
 

Detailed Description

This class defines the general interface to handle gcode communication with the firmware. This allows it to connect to different data sources and handle them all inside the same data structure. If several readers are active, the first one sending a byte pauses all other inputs until the command is complete. Only then the next reader will be queried. New queries are started in round robin fashion so every channel gets the same chance to send commands.

Available source types are:

  • serial communication port
  • sd card
  • flash memory

Constructor & Destructor Documentation

◆ GCodeSource()

GCodeSource::GCodeSource ( )

◆ ~GCodeSource()

virtual GCodeSource::~GCodeSource ( )
inlinevirtual

Member Function Documentation

◆ close()

virtual void GCodeSource::close ( )
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ closeOnError()

virtual bool GCodeSource::closeOnError ( )
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ dataAvailable()

virtual bool GCodeSource::dataAvailable ( )
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ isOpen()

virtual bool GCodeSource::isOpen ( )
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ printAllFLN() [1/2]

void GCodeSource::printAllFLN ( FSTRINGPARAM(text)  )
static

◆ printAllFLN() [2/2]

void GCodeSource::printAllFLN ( FSTRINGPARAM(text)  ,
int32_t  v 
)
static

◆ readByte()

virtual int GCodeSource::readByte ( )
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ registerSource()

void GCodeSource::registerSource ( GCodeSource *  newSource)
static

◆ removeSource()

void GCodeSource::removeSource ( GCodeSource *  delSource)
static

◆ rotateSource()

void GCodeSource::rotateSource ( )
static

Move active to next source.

< Move active to next source

◆ supportsWrite()

virtual bool GCodeSource::supportsWrite ( )
pure virtual

true if write is a non dummy function

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ writeByte()

virtual void GCodeSource::writeByte ( uint8_t  byte)
pure virtual

Implemented in FlashGCodeSource, and SerialGCodeSource.

◆ writeToAll()

void GCodeSource::writeToAll ( uint8_t  byte)
static

Write to all listening sources.

< Write to all listening sources

Member Data Documentation

◆ activeSource

GCodeSource * GCodeSource::activeSource = &serial0Source
static

◆ lastLineNumber

uint32_t GCodeSource::lastLineNumber

◆ numSources

fast8_t GCodeSource::numSources = 2
staticprivate

Number of data sources available.

◆ numWriteSources

fast8_t GCodeSource::numWriteSources = 2
staticprivate

◆ sources

GCodeSource * GCodeSource::sources = {&serial0Source,&serial1Source}
staticprivate

◆ timeOfLastDataPacket

millis_t GCodeSource::timeOfLastDataPacket

◆ waitingForResend

int8_t GCodeSource::waitingForResend

Waiting for line to be resend. -1 = no wait.

◆ wasLastCommandReceivedAsBinary

uint8_t GCodeSource::wasLastCommandReceivedAsBinary

Was the last successful command in binary mode?

◆ writeableSources

GCodeSource * GCodeSource::writeableSources = {&serial0Source,&serial1Source}
staticprivate

The documentation for this class was generated from the following files: